//  @ Project : GagalPanen
//  @ File Name : game.hpp
//  @ Date : 3/9/2011
//  @ Author : 
//
//


#if !defined(_GAME_H)
#define _GAME_H

#include <string.h>
#include <fstream>
#include "gameinterface.hpp"
#include "creatures.hpp"
#include "inventory.hpp"
#include "gametime.hpp"
#include "sprites.hpp"
#include "gamemaps.hpp"
#include "view.hpp"
#include "parser.hpp"
#include "disaster.hpp"


class Game : public GameInterface {
public:
  // constructs a new game
  Game(std::string username, std::string filename);

  // loads a game
  Game(std::ifstream& is, std::string filename);

  virtual ~Game();

  int getActionsCount();
  Creatures* getCreatures();
  Inventory* getInventory();
  GameMaps* getMaps();
  GameTime* getGameTime();
  View* getView();
  Disaster* getDisaster();
  int getMaximumActionsPerDay();
  void playerBuy(std::string item_name, int count);
  void playerSell(int slot_number, int count);
  virtual void playerEat(int slot_number);
  void playerHarvest();
  void playerRight();
  void playerLeft();
  void playerUp(int step_count);
  void playerDown();
  void playerEast();
  void playerWest();
  void playerNorth();
  void playerSouth();
  void playerPlow();
  void playerPut(int slot_id, int count);
  void playerShowStore();
  void playerSickle();
  void playerTeleport(std::string nama_area_tujuan);
  void playerShowTeleportHelp();
  void playerWakeSpriteUp(int id);
  void playerWater();
  void playerSaveGame();
  void playerSetSpriteToSleep(int id);
  void playerShowInventory();
  void start();
  void playerExitGame();
  void playerShowSpriteStatus();
  void playerSleep();
  void playerHelp();
  void playerSuperAction();
private:
  GameMaps maps_;
  Creatures creatures_;
  Inventory inventory_;
  GameTime time_;
  Disaster disaster_;
  View view_;
  Parser parser_;
  void advanceDay();
  void advanceTime();
  void updateGraphics();

  std::string username_;
  std::string filename_;

  bool exit_called_;
};

#endif  //_GAME_H
